package com.qf.mapper2;

import com.qf.domain2.Classes;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ClassesMapper {

    @Select("SELECT cl.id cid,cl.name cname,s.* \n" +
            "FROM classes cl,student s \n" +
            "WHERE cl.`id`=s.`cid`")
    @ResultMap("classesMap")
    List<Classes> findAll();


    /**
     * 根据id查询班级信息
     * @param id
     * @return
     */
    @Select("select * from classes where id=#{id}")
    Classes findById(Integer id);
}
